--- autoconf.sh.orig	Tue Jan  5 06:27:53 1999
+++ autoconf.sh	Wed Mar 27 09:49:29 2002
@@ -45,7 +45,8 @@ case "${M4}" in
 esac
 
 : ${TMPDIR=/tmp}
-tmpout=${TMPDIR}/acout.$$
+tmpout=`mktemp ${TMPDIR}/acout.XXXXXXXXXX` || exit 1
+rm -f $tmpout
 localdir=
 show_version=no
 
@@ -96,8 +97,18 @@ case $# in
 esac
 
 trap 'rm -f $tmpin $tmpout; exit 1' 1 2 15
+if fgrep AC_ $infile >/dev/null; then
+  :
+else 
+  if fgrep "This is Cygnus Configure" configure >/dev/null; then
+    echo "Error: not an autoconf $infile" >&2
+    exit 1
+  fi
+fi
 
-tmpin=${TMPDIR}/acin.$$ # Always set this, to avoid bogus errors from some rm's.
+tmpin=`mktemp ${TMPDIR}/acin.XXXXXXXXXX` || { rm -f $tmpout; exit 1; }
+rm -f $tmpin
+# Always set this, to avoid bogus errors from some rm's.
 if test z$infile = z-; then
   infile=$tmpin
   cat > $infile
@@ -112,16 +123,7 @@ else
   use_localdir=
 fi
 
-# Use the frozen version of Autoconf if available.
-r= f=
-# Some non-GNU m4's don't reject the --help option, so give them /dev/null.
-case `$M4 --help < /dev/null 2>&1` in
-*reload-state*) test -r $AC_MACRODIR/autoconf.m4f && { r=--reload f=f; } ;;
-*traditional*) ;;
-*) echo Autoconf requires GNU m4 1.1 or later >&2; rm -f $tmpin; exit 1 ;;
-esac
-
-$M4 -I$AC_MACRODIR $use_localdir $r autoconf.m4$f $infile > $tmpout ||
+$M4 -g -D__gnu__ -I$AC_MACRODIR $use_localdir autoconf.m4 $infile > $tmpout ||
   { rm -f $tmpin $tmpout; exit 2; }
 
 # You could add your own prefixes to pattern if you wanted to check for
